﻿//
// VKSL - Visual Knowledge in Second Life
// 2007(c) CC License by-nc-sa-2.5-it
//
// Authors:
//     JonnyBee Cioc    jonny@vulca.no
//     VisionRaymaker   vision.raymaker@vulca.no

// ===[ LICENSE ]=======================================

// License Creative Commons Attribution-Noncommercial-Share Alike 2.5 Italy
// http://creativecommons.org/licenses/by-nc-sa/2.5/it/

// ===[ CHANGE LOG ]====================================
integer version_major    =  1;
integer version_minor    =  0;
integer version_revision = 13;

// LINKED MESSAGE PUBLIC INTERFACE

// MODULE
integer MESSAGELINKED_RESET            = 0xFFFF;
integer MESSAGELINKED_MODULEREADY      = 0xFFFE;
integer MESSAGELINKED_VERSION          = 0xFFFD;

string version() { return "v"+(string)version_major+"."+(string)version_minor+"."+(string)version_revision; }

default
{
    state_entry()
    {
        // send reset command to all script
        llMessageLinked(LINK_SET, MESSAGELINKED_MODULEREADY, llGetScriptName()+" "+version(),llGetLinkKey(llGetLinkNumber()));
    }

    link_message(integer linknum, integer cmd, string message, key id)
    {
        key myself = llGetLinkKey(llGetLinkNumber());
        if(cmd==MESSAGELINKED_VERSION && id!=myself)
            llMessageLinked(linknum, MESSAGELINKED_VERSION, version(), id);
        else if(cmd==MESSAGELINKED_RESET)
            llResetScript();
    }
}